package com.foton.lotterydomain.strategy.service.draw;

import com.foton.lotterycommon.common.Constants;
import com.foton.lotterydomain.strategy.service.algorithm.IDrawAlgorithm;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author RenPu
 * @Date 2023/11/24 10:06
 * @Version 1.0
 * @Description: 抽奖策略配置类
 * 初始化抽奖算法实例，封装到策略容器中
 **/
public class DrawConfig {

    @Resource
    private IDrawAlgorithm defaultRateRandomDrawAlgorithm;   //默认抽奖算法【必中奖】

    @Resource
    private IDrawAlgorithm singleRateRandomDrawAlgorithm;    //推荐抽奖算法【不一定中间】

    //抽奖策略实例容器
    protected Map<Integer, IDrawAlgorithm> drawAlgorithmstateMap = new ConcurrentHashMap<>();

    @PostConstruct
    public void init() {
        drawAlgorithmstateMap.put(Constants.StrategyMode.SINGLE.getCode(), singleRateRandomDrawAlgorithm);
        drawAlgorithmstateMap.put(Constants.StrategyMode.ENTIRETY.getCode(), defaultRateRandomDrawAlgorithm);
    }


}
